
import constant.Constant;
import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;


import java.io.File;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.net.URL;

public class Start extends Application {


    @Override
    public void start(Stage primaryStage) throws Exception{
        File file = new File("info/fxml/mainFrame.fxml");
        URL url =file.toURI().toURL();

        Parent root = FXMLLoader.load(url);
//        URL url = new URL("","","info/fxml/mainFrame.fxml");
//        Parent root = FXMLLoader.load(url);

        primaryStage.setTitle("Hello World");
        primaryStage.setScene(new Scene(root, Constant.width, Constant.height));


        primaryStage.setTitle(Constant.titile);

//        primaryStage.setX(1200);
//        primaryStage.setY(500);
        primaryStage.setResizable(false);
        primaryStage.getIcons().add(Constant.ico);
        primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
            @Override
            public void handle(WindowEvent event) {
                System.out.println("程序退出了");
                System.exit(0);
            }
        });
        Constant.primaryStage = primaryStage;
        primaryStage.show();
    }


    public static void main(String[] args) {
        launch(args);
    }
}
